package study.mq.rocketmq.producer.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import study.eggs.result.Result;
import study.eggs.result.Results;

@Slf4j
@RestController
public class _4_OneWayController {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    @RequestMapping("/oneway")
    public Result send(@RequestBody Request request) {
        rocketMQTemplate.sendOneWay(request.getDest(), request.getData());
        return Results.ok();
    }
}
